home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr50 / pbc22b.zip / PLAYVOC.BAS < prev   
BASIC Source File  |  1993-04-26  |  3KB  |  79 lines

  1. '   +----------------------------------------------------------------------+
  2. '   |                                                                      |
  3. '   |       PBClone  Copyright (c) 1990-1993  Thomas G. Hanlin III         |
  4. '   |                                                                      |
  5. '   +----------------------------------------------------------------------+
  6.  
  7. ' This is another simple demo of the PBClone routines.  It allows you to
  8. ' play a digitized sound file (.VOC format) on a SoundBlaster.  The SBSIM
  9. ' driver, which is provided with SoundBlaster, is required.
  10.  
  11. ' Syntax:
  12. '   PLAYVOC vocname[.VOC]
  13.  
  14. ' The file extension is optional.
  15.  
  16. ' Typically, this would be converted to an .EXE file using these steps:
  17. '    BC PLAYVOC/O;
  18. '    LINK PLAYVOC/EX,,NUL,PBCLONE;
  19.  
  20.    DECLARE SUB SBGetActive (FM%, DskVoice%, MemVoice%, Auxiliary%, MIDI%)
  21.    DECLARE FUNCTION SBInt% ()
  22.    DECLARE SUB SBInitSrcFile (BYVAL DriverNr%, FileName$, ErrCode%)
  23.    DECLARE SUB SBPlay (BYVAL DriverNr%)
  24.    DECLARE SUB SBStop (BYVAL DriverNr%)
  25.  
  26.    DEFINT A-Z
  27.  
  28.  
  29.  
  30.    '--- Pluck filename from command line.
  31.    File$ = LTRIM$(RTRIM$(UCASE$(COMMAND$)))
  32.  
  33.    '--- If they didn't enter a filename, let's tell 'em about ourselves.
  34.    IF LEN(File$) = 0 OR INSTR(File$, "/?") > 0 THEN
  35.       PRINT "PLAYVOC: Digitized Sound Player for PBClone by Thomas G. Hanlin III"
  36.       PRINT
  37.       PRINT "Syntax:"
  38.       PRINT "  PLAYVOC vocname[.VOC]
  39.       PRINT
  40.       PRINT "The file extension is optional and defaults to .VOC.  This demo plays .VOC"
  41.       PRINT "digitized sound files on a SoundBlaster, using the SBSIM driver."
  42.       END
  43.    END IF
  44.  
  45.    '--- Add .VOC extension if they didn't provide it.
  46.    IF INSTR(File$, ".") = 0 THEN File$ = File$ + ".VOC"
  47.  
  48.    '--- Check the SBSIM interrupt to make sure SBSIM is installed.
  49.    IF SBInt = 0 THEN
  50.       PRINT "PLAYVOC requires the SBSIM driver to function.  SBSIM is provided with the"
  51.       PRINT "SoundBlaster.  Go to your SoundBlaster directory and type SBSIM to install"
  52.       PRINT "the driver before using PLAYVOC.  You will probably get some extraneous error"
  53.       PRINT "messages from SBSIM-- ignore them.  PLAYVOC will tell you of any problem."
  54.       END
  55.    END IF
  56.  
  57.    '--- This is the number of the Disk Voice driver used for .VOC playing.
  58.    DriverNr = 2
  59.  
  60.    '--- Here we initialize Disk Voice handling for our .VOC file.
  61.    SBInitSrcFile DriverNr, File$, ErrCode
  62.    IF ErrCode THEN
  63.       PRINT "Error initializing "; File$; " for input.  Error code ="; ErrCode
  64.       END
  65.    END IF
  66.  
  67.    '--- This starts the .VOC file playing
  68.    SBPlay DriverNr
  69.  
  70.    '--- The file plays in the background, so we could do something here.
  71.    '--- In this case, though, we'll just wait for the file to finish.
  72.    '--- We'll exit if <ESC> is pressed, in case they want out.
  73.    DO
  74.       SBGetActive FM, DskVoice, MemVoice, Auxiliary, MIDI
  75.    LOOP UNTIL DskVoice = 0 OR INKEY$ = CHR$(27)
  76.  
  77.    '--- When we're done, we shut down the Disk Voice driver.
  78.    SBStop DriverNr
  79.